<% content_for :page_title do %>
  <%= Spree.t(:settings) %>
<% end %>

<% content_for :title do %>
  <%= Spree.t(:settings) %>
<% end %>


<%= content_for(:page_actions) do %>
  <%= turbo_save_button_tag Spree.t('actions.update'), form: "edit_store_#{@store.id}" %>
<% end %>

<%= render partial: 'spree/admin/shared/error_messages', locals: { target: @store }, class: 'mb-5 pb-5' %>

<%= form_for @store, url: spree.admin_storefront_path, method: :patch do |f| %>
  <div class="row">
    <div class="col-lg-6 offset-lg-3">
      <div class="card mb-4">
        <div class="card-header">
          <h5 class="card-title">
            <%= Spree.t(:seo) %>
          </h5>
        </div>
        <div class="card-body">
          <%= f.spree_text_field :seo_title %>
          <%= f.spree_text_area :meta_description %>
          <%= f.spree_check_box :preferred_index_in_search_engines, label: Spree.t(:index_in_search_engines), help: 'Checking this box will allow your site to appear in search engines.' %>
        </div>
      </div>

      <div class="card mb-4">
        <div class="card-header">
          <h5 class="card-title">
            <%= Spree.t(:security) %>
          </h5>
        </div>
        <div class="card-body" data-controller="reveal" data-reveal-hidden-class="d-none">
          <%= f.spree_check_box :preferred_password_protected, label: Spree.t(:password_protected), help: 'Checking this box will put your storefront behind a password.', data: { action: 'reveal#toggle' } %>
          <div class="d-none" data-reveal-target="item">
            <%= f.spree_text_field :storefront_password, label: Spree.t(:password), help: 'Enter a password to protect your storefront.' %>
          </div>
        </div>
      </div>

      <div class="card mb-4">
        <div class="card-header">
          <h5 class="card-title">
            <%= Spree.t(:custom_code) %>
          </h5>
        </div>
        <div class="card-body">
          <%= f.spree_text_area :storefront_custom_code_head, rows: 4 %>
          <%= f.spree_text_area :storefront_custom_code_body_start, rows: 4 %>
          <%= f.spree_text_area :storefront_custom_code_body_end, rows: 4 %>
        </div>
      </div>

      <div class="card mb-4">
        <div class="card-header">
          <h5 class="card-title">
            <%= Spree.t(:images) %>
          </h5>
        </div>
        <div class="card-body">
          <%= f.spree_file_field :favicon_image, width: 120, height: 120, crop: true, label: 'Favicon image', help_bubble: "A favicon is a small image that appears in the tab of your web browser when you visit a website. It is usually a tiny square or rectangle with a unique design or logo that represents the website" %>

          <%= f.spree_file_field :social_image, width: 1200, height: 630, crop: true, label: 'Preview image', help_bubble: "This image will be used when your store is shared on social media or in search engines." %>
        </div>
      </div>

      <div class="card mb-4">
        <div class="card-header">
          <h5 class="card-title">
            <%= Spree.t(:social_media) %>
          </h5>
        </div>
        <div class="card-body">
          <div class="alert alert-info">
            Social links will be displayed in the footer of your store
          </div>
          <% Spree::Store::SUPPORTED_SOCIAL_NETWORKS.each do |social| %>
            <%= f.spree_text_field social.to_sym, label: social.capitalize, placeholder: Spree::Store::SOCIAL_NETWORKS_CONFIG[social.to_sym][:input_placeholder] %>
          <% end %>
        </div>
      </div>
    </div>
  </div>
<% end %>
